Skip to content

Conversation

@mahmoud-elmorabea
Copy link
Contributor

@mahmoud-elmorabea mahmoud-elmorabea commented Jan 6, 2026

The issue

This PR fixes an issue for in-app Android. Sometimes when there are multiple messages the GistModalActivity animation takes longer than the processor to update the state. In which case, the activity dismisses the wrong message.

  • Activity showing message 1
  • Message 1 is dismissed by the controller
  • Message 2 is queued up and shown in a new instance of the activity
  • onDestroy of old activity runs and grabs the current message -> which is now message 2
    Dismisses it as per this

This is not really related to SSE but it's more apparent because SSE shows subsequent messages faster.

The fix

  • When the GistModalActivity is created, it holds on to the message it was created to show
  • When onDestroy runs, we make sure not to call dismiss unless our message is being shown

Note

Fix race condition in modal dismissal

  • GistModalActivity: track activityMessage and in onDestroy dispatch DismissMessage only if its queueId matches the currently displayed message; persistent messages dismiss with shouldLog = false. Minor refactor: isPersistentMessage(message: Message?).
  • InAppMessagingMiddlewares: after dismissal, gate queue processing by store.state.shouldUseSse (was sseEnabled).
  • Tests: add scenarios validating correct/incorrect dismiss behavior and persistent handling; refactor test init to return InAppMessagingManager.

Written by Cursor Bugbot for commit e795523. This will update automatically on new commits. Configure here.

@mahmoud-elmorabea mahmoud-elmorabea self-assigned this Jan 6, 2026
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.


@mahmoud-elmorabea mahmoud-elmorabea changed the title chore: Sse wrap up chore: SSE bug fixes Jan 6, 2026
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

  • java_layout: Build failed. See CI job logs to determine the issue and try re-building.

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

  • kotlin_compose: Build failed. See CI job logs to determine the issue and try re-building.

@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.30%. Comparing base (126b67c) to head (e795523).
⚠️ Report is 1 commits behind head on feature/in-app-sse.

Files with missing lines Patch % Lines
...saginginapp/gist/presentation/GistModalActivity.kt 75.00% 0 Missing and 2 partials ⚠️
.../messaginginapp/state/InAppMessagingMiddlewares.kt 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                   Coverage Diff                    @@
##             feature/in-app-sse     #639      +/-   ##
========================================================
+ Coverage                 67.85%   68.30%   +0.44%     
- Complexity                  748      760      +12     
========================================================
  Files                       142      142              
  Lines                      4303     4303              
  Branches                    580      580              
========================================================
+ Hits                       2920     2939      +19     
+ Misses                     1165     1141      -24     
- Partials                    218      223       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

  • java_layout: sse-wrap-up (1767713150)

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

  • kotlin_compose: sse-wrap-up (1767713151)

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Build available to test
Version: sse-wrap-up-SNAPSHOT
Repository: https://s01.oss.sonatype.org/content/repositories/snapshots/

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

📏 SDK Binary Size Comparison Report

Module Last Recorded Size Current Size Change in Size
core 29.85 KB 29.85 KB ✅ No Change
datapipelines 38.89 KB 38.89 KB ✅ No Change
messagingpush 30.25 KB 30.25 KB ✅ No Change
messaginginapp 106.50 KB 106.61 KB ⬆️ +0.11KB
tracking-migration 22.89 KB 22.89 KB ✅ No Change

@mahmoud-elmorabea mahmoud-elmorabea marked this pull request as ready for review January 6, 2026 15:52
@mahmoud-elmorabea mahmoud-elmorabea requested a review from a team as a code owner January 6, 2026 15:52
@github-actions
Copy link

github-actions bot commented Jan 7, 2026

  • java_layout: sse-wrap-up (1767773205)

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

  • kotlin_compose: sse-wrap-up (1767773209)

Copy link
Contributor

@mrehan27 mrehan27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Just two questions before we merge this:

  • Do we also need to add message equality check in subscriber (subscribeToAttributes), or is adding it in onDestroy sufficient?
  • Can we add some tests to cover these changes?

@github-actions
Copy link

  • kotlin_compose: sse-wrap-up (1768299885)

@github-actions
Copy link

  • java_layout: sse-wrap-up (1768299884)

@github-actions
Copy link

  • java_layout: sse-wrap-up (1768300462)

@github-actions
Copy link

  • kotlin_compose: sse-wrap-up (1768300462)

@github-actions
Copy link

  • kotlin_compose: sse-wrap-up (1768301185)

@github-actions
Copy link

  • java_layout: sse-wrap-up (1768301177)

@mahmoud-elmorabea mahmoud-elmorabea merged commit b3aad11 into feature/in-app-sse Jan 13, 2026
44 of 45 checks passed
@mahmoud-elmorabea mahmoud-elmorabea deleted the sse-wrap-up branch January 13, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants